<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>接种记录管理</title>
<meta name="decorator" content="default"/>
<script src="${ctxStatic}/common/change/change.js"></script>
<script type="text/javascript">
$(document).ready(function() {
	initVaccName(childVaccRecord.companyCode,childVaccRecord.vaccineId);
	initVaccCompanyName(childVaccRecord.companyCode)
	$(".vaccineCompany").change(function(){
		var vaccId = $(this).val();
		initCompanyName($(this).val());
		if(vaccId == ""){
			initVaccCompanyName("");
		}
	});
	$(document).on("click","#btnReset",function(){
		$("#storeCodeId").val("");
		$("#storeCodeName").val("");
		$("#childName").val("");
		$("#childCode").val("");
		$("#cType").val("").select2();
		$("#vaccineId").val("").select2();
		$("#companyCode").val("").select2();
		$("#beginTime").val("");
		$("#endTime").val("");
		
	});
	$("#searchForm").validate({
		submitHandler: function(form){
			form.submit();
			var index = layer.load(2, {shade: [0.5, '#000']});
		},
		ignore: ":hidden",
		errorContainer: "#messageBox",
		errorPlacement: function(error, element) {
			$("#messageBox").text("输入有误，请先更正。");
			if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
				error.appendTo(element.parent().parent());
			} else {
				error.insertAfter(element);
			}
		}
	});
});
var childVaccRecord = JSON.parse('${fns:toJson(childVaccRecord)}');
function page(n,s){
	$("#pageNo").val(n);
	$("#pageSize").val(s);
	$("#searchForm").submit();
    return false;
}
function down(){
	top.$.jBox.confirm("确认要导出儿童接种记录信息数据吗？","系统提示",function(v,h,f){
		if(v=="ok"){
			$("#searchForm").attr("action","${ctx}/childvaccrecord/childVaccRecord/export");
			$("#searchForm").submit();
		}
		$("#searchForm").attr("action","${ctx}/childvaccrecord/childVaccRecord/list?type=1");
	},{buttonsFocus:1});
	top.$('.jbox-body .jbox-icon').css('top','55px');
}
</script>
<style type="text/css">
	.minWidth {
		min-width: 177px;
	}	
	#contentTable td ,#contentTable th{
		text-align: center;
		padding: 1px 20px;
	}
</style>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="#">接种记录列表</a></li>
	</ul>
	<form:form id="searchForm" modelAttribute="childVaccRecord" action="${ctx}/childvaccrecord/childVaccRecord/list?type=1" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<div class="breadcrumb">
			<table class="table table-bordered">
			     <tr>
			        <th>疫苗属性</th>
					<td>
						<form:select path="cType" class="span2 minWidth">
							<form:option value="" label="--请选择--"/>
							<form:options items="${fns:getDictList('bs_vaccineInfo_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
						</form:select>
					</td>
				    <th>疫苗名称:</th>
					<td>
						<form:select path="vaccineId" id="vaccineId" class="span2 minWidth vaccineCompany" >
							<form:option value="" label="--请选择--"/>
						</form:select>
					</td>
					<th>生产企业：</th>
					<td>
						<form:select path="companyCode" id="companyCode" class="span2 minWidth changeCompany vaccCompanyName">
						    <form:option value="" label="--请选择--"/> 
						</form:select>
					</td>
				</tr>
				<tr>
			        <th>地区</th>
					<td>
						<sys:treeselect2 id="storeCode" name="storeCode" value="${childVaccRecord.storeCode}" labelName="storeName" labelValue="${childVaccRecord.storeName}"
					    title="机构" url="/sys/office/treeData" cssClass="input-medium" layer = "true"/>
					</td>
					<th>儿童姓名</th>
					<td colspan="3">
						<form:input path="childName" id="childName" class="span2 minWidth"/>
					</td>
					<%-- <th>儿童编码</th>
					<td>
						<form:input path="childCode" id="childCode" class="span2 minWidth"/>
					</td> --%>
				</tr>
				<tr>
					<th>起始日期</th>
					<td>
						<input name="beginTime" id ="beginTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
							value="<fmt:formatDate value="${childVaccRecord.beginTime}" pattern="yyyy-MM-dd"/>"
							onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
					</td>
					<th>截止日期</th>
					<td colspan="3">
						<input name="endTime" id ="endTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
							value="<fmt:formatDate value="${childVaccRecord.endTime}" pattern="yyyy-MM-dd"/>"
							onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
					</td>
				</tr>
			</table>
		</div>
		<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
		<input id="btnReset" class="btn btn-primary" type="button" value="重置"/>
		<input id="btnExcel" class="btn btn-primary" type="button" value="导出" onclick="down()"/>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
			    <th>编号</th>
			    <th>儿童姓名</th>
			    <th>疫苗属性</th>
			    <th>疫苗名称</th>
			    <th>生产企业</th>
			    <th>批号</th>
			    <th>针次</th>
			    <th>接种部位</th>
			    <th>接种日期</th>
			    <th>接种单位</th>
			    <th>接种医生</th>
			    <th>接种类型</th>
			    <th>备注</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="childVaccRecord" begin = "0" varStatus="status">
			<tr>
				<td>
					${(page.pageNo-1)*page.pageSize+status.index+1 }
				</td>
				<td>
					${childVaccRecord.childName}
				</td>
				<td>
				    <c:if test="${childVaccRecord.price == 0}">
				          第一类
				    </c:if>
					<c:if test="${childVaccRecord.price != 0}">
				          第二类
				    </c:if>
				</td>
				<td>
					${childVaccRecord.vaccName}
				</td>
				<td>
					${childVaccRecord.companyName}
				</td>
				<td>
					${childVaccRecord.batch}
				</td>
				<td>
					${fns:getDictLabel(childVaccRecord.dosage,'pin','')}
				</td>
				<td>
					${fns:getDictLabel(childVaccRecord.bodyPart, "position", "")}
				</td>
				<td>
				    <fmt:formatDate value="${childVaccRecord.vaccinateDate}" pattern="yyyy-MM-dd"/>
				    
				</td>
				<td>
					${childVaccRecord.storeName}
				</td>
				<td>
					${childVaccRecord.doctor}
				</td>
				<td>
					${fns:getDictLabel(childVaccRecord.vaccType,'bs_vaccine_dose1','')}
				</td>
				<td>
					${childVaccRecord.remarks}
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>